using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class ShowArticle : Shop, IRequiresSessionState
{
	protected Literal pTitle;
	protected UserControls_cmpy_Top Top1;
	protected Literal ArticleNav;
	protected Literal Literal1;
	protected Literal ArticleTitle;
	protected Literal Authour;
	protected Literal WriteDate;
	protected Literal Hits;
	protected HyperLink ArticlePrev;
	protected HyperLink ArticleNext;
	protected Literal ArticleContent;
	protected Shop_UserControls_ShowProduct ShowProduct65;
	protected Shop_UserControls_ShowProduct ShowProduct59;
	protected UserControls_CMYP_Foot Foot1;
	protected HtmlForm form1;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_PreInit(object sender, EventArgs e)
	{
		try
		{
		}
		catch (Exception ex)
		{
			base.WriteTemErrMsg(ex.Message.ToString());
		}
		int iD = Fetch.GetID("id");
		if (iD > 0)
		{
			Shop_Article shop_Article = new Shop_Article(this.conn);
			DataTable articleByArticleID = shop_Article.GetArticleByArticleID(iD);
			if (articleByArticleID.Rows.Count > 0)
			{
				shop_Article.UpdateHits(iD);
				if (articleByArticleID.Rows[0]["TemplatePath"].ToString() != "")
				{
					string text = articleByArticleID.Rows[0]["TemplatePath"].ToString();
				}
				string text2 = articleByArticleID.Rows[0]["ShortTitle"].ToString();
				string text3 = articleByArticleID.Rows[0]["LognTitle"].ToString();
				string a = articleByArticleID.Rows[0]["LinkType"].ToString();
				string text4 = articleByArticleID.Rows[0]["ArticleContent"].ToString();
				this.pTitle.Text = text2;
				this.ArticleNav.Text = string.Concat(new string[]
				{
					"<a href='List.aspx?CID=",
					articleByArticleID.Rows[0]["ChannelID"].ToString(),
					"'>",
					this.conn.GetScalar("SELECT Title FROM HLShop_Module WHERE id=" + articleByArticleID.Rows[0]["ChannelID"].ToString(), new IDbDataParameter[0]).ToString(),
					"</a>"
				});
				int num = (int)articleByArticleID.Rows[0]["Status"];
				DataTable articlePrevAndNextByArticleId = shop_Article.GetArticlePrevAndNextByArticleId(iD, true);
				if (articlePrevAndNextByArticleId != null)
				{
					if (articlePrevAndNextByArticleId.Rows.Count > 0)
					{
						this.ArticlePrev.Text = Language.Get("Common/Previous") + articlePrevAndNextByArticleId.Rows[0]["ShortTitle"].ToString();
						this.ArticlePrev.NavigateUrl = "ShowArticle.aspx?id=" + articlePrevAndNextByArticleId.Rows[0]["ArticleID"].ToString();
					}
					articlePrevAndNextByArticleId.Dispose();
				}
				articlePrevAndNextByArticleId = shop_Article.GetArticlePrevAndNextByArticleId(iD, false);
				if (articlePrevAndNextByArticleId != null)
				{
					if (articlePrevAndNextByArticleId.Rows.Count > 0)
					{
						this.ArticleNext.Text = Language.Get("Common/Next") + articlePrevAndNextByArticleId.Rows[0]["ShortTitle"].ToString();
						this.ArticleNext.NavigateUrl = "ShowArticle.aspx?id=" + articlePrevAndNextByArticleId.Rows[0]["ArticleID"].ToString();
					}
					articlePrevAndNextByArticleId.Dispose();
				}
				if (a == "1" && (string.IsNullOrEmpty(text4) || text4 == ""))
				{
					string text5 = articleByArticleID.Rows[0]["LinkUrl"].ToString();
					if (text5 != "")
					{
						base.Response.Redirect(text5);
					}
					else
					{
						this.WriteErrMsg("", Language.Get("Common/NotData"), "");
					}
					articleByArticleID.Dispose();
					base.Response.End();
				}
				else
				{
					if (text3.Length > 0)
					{
						this.ArticleTitle.Text = text3;
					}
					else
					{
						if (text2.Length > 0)
						{
							this.ArticleTitle.Text = text2;
						}
					}
					this.Authour.Text = articleByArticleID.Rows[0]["Editor"].ToString();
					this.WriteDate.Text = articleByArticleID.Rows[0]["InputTime"].ToString();
					if (num == 0)
					{
						this.ArticleContent.Text = "该文章已过期或尚未通过审核！";
					}
					else
					{
						this.ArticleContent.Text = text4;
					}
					this.Hits.Text = articleByArticleID.Rows[0]["Hits"].ToString();
					articleByArticleID.Dispose();
				}
			}
			else
			{
				this.WriteErrMsg("", Language.Get("Common/NotData"), "");
			}
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		base.ShowCityArea();
	}
}
